(* Test pour bopmap *)
open Bplib
open MopTypes
open BopMopImp

let _ =
  Message.message#thisis "bopmap";
  let args = Array.to_list Sys.argv in
  if Array.length Sys.argv < 2
  then prerr_endline (Printf.sprintf "use : %s myfile.mop" Sys.argv.(0))
  else
    begin
      let str = MapStruct.of_file Sys.argv.(1) in
      if List.mem "-v" args then prerr_endline (MapStruct.repr 0 str) else ();
      while true do
	let input = input_line stdin in 
	(* try *)
	  Scanf.sscanf input "%s %s %s" (fun a b c -> 
					    let bo = BoolArray.of_string c in
					    print_endline (MapStruct.map str a b bo))
	(* with
	| _ -> prerr_endline "syntax : %s %s"; print_endline ""
	*)
      done
    end
